fhand = open('mbox.txt', 'r')

count = 0
for line in fhand:
    if line.startswith('From'):
        count += 1

    if not line.startswith('From: '):
        continue
    words = line.split()
    if len(words) == 0:
        continue
    print(words[1])

print(f'There were {count} lines in the file with From as the first word')
